package components
{
	import spark.primitives.BitmapImage;
	import flash.filters.DropShadowFilter;
	/*
	[Style(name="dShadowDistance", type="Number", format="Number", inherit="no")]
	[Style(name="dShadowAngle", type="Number", format="Number", inherit="no")]
	[Style(name="dShadowColor", type="uint", format="Color", inherit="no")]
	[Style(name="dShadowBlurX", type="Number", format="Number", inherit="no")]
	[Style(name="dShadowBlurY", type="Number", format="Number", inherit="no")]
	[Style(name="dShadowAlpha", type="Number", format="Number", inherit="no")]
	*/
	public class BitmapImageWithDropShadow extends BitmapImage
	{
		private var dShadow:DropShadowFilter = new DropShadowFilter();
		
		public function BitmapImageWithDropShadow()
		{
			super();
		}
		
		
		
		override public function set source(value:Object):void
		{
			super.source=value;
			
			var props:Object = { 
				dShadowDistance: { prop: "distance", def: 3},
				dShadowAngle: { prop: "angle", def: 35}, 
				dShadowColor: {prop: "color", def: 0x000000},
				dShadowBlurY: {prop: 'blurY', def: 2},
				dShadowBlurX: {prop: 'blurX', def: 2},
				dShadowAlpha: {prop: 'alpha', def: .3}
			};
			
			for(var prop:String in props)
			{
				var obj:Object = props[prop];
				dShadow[obj.prop] = obj.def;
			}
			dShadow.quality = 3;
			this.filters = [dShadow];
		}
		
	}
}